<template>
  <div class="" v-if="file!=''">
    <iframe
      :style="styleFitWin"
      class=""
      :src="'https://ow365.cn/?i=28004&ssl=1&n=5&furl=' +file"

    ></iframe>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        token: localStorage.getItem('token'),
        id: '',
        key: '',
        type: '',
        file:'',
        styleFitWin: {
          position: 'fixed',
          height:'100%',
          width:'100%'
        },
      }
    },
    created() {
      this.type = this.$route.query.type
      this.id = this.$route.query.id
      this.key = this.$route.query.key
      this.getplay()
    },
    methods: {
      getplay() {
        let form;
        if (this.type == 1) {
          form = {
            token: this.token,
            content_id: this.id,
            key: this.key
          }
        } else if (this.type == 2) {
          form = {
            token: this.token,
            course_id: this.id,
            key: this.key
          }
        }
        this.$api('index.getEnclosureUrl', form).then(res => {
          //console.log(res)
          this.file=res.data.value
        });
      }
    }
  }
</script>

<style>
</style>
